package com.candy.localaccount;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;

public class Utils {
    public static final String ACCOUNT_NAME_PHONE = "PHONE";
    public static final String ACCOUNT_TYPE_SIM = "com.android.sim";
    public static final String ACCOUNT_TYPE_PHONE = "com.android.localphone";
    public static final String ACCOUNT_TYPE_EXCHANGE_AOSP = "com.android.exchange";

    public static final String ACCOUNT_NAME_CANDY = "Candy";
    public static final String ACCOUNT_TYPE_CANDY = "com.candy.local";

    public static boolean isAtLeastM() {
        return Build.VERSION.SDK_INT >= 23;
    }

    /**
     * 跳转到权限设置界面
     */
    public static void getAppDetailSettingIntent(Context context) {
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
        intent.setData(Uri.fromParts("package", context.getPackageName(), null));

        context.startActivity(intent);
    }
}
